@extends('livewire.side-mune')
@section('content')
<x-bladewind.centered-content size="small">
    @foreach($servers as $server)
    <div class="card">
        <h5 class="card-header">{{ $server->ip_address }}</h5>
        <div class="card-body">
            <h5 class="card-title">{{ $server->name }}</h5>
            <ul class="list-group list-group-flush">
                @foreach($server->connections as $connection)
                    <li class="list-group-item">
                    <a href="{{ route('server.page', ['connection' => $connection->connection, 'ip' => $server->ip_address]) }}">
                        <x-bladewind.button icon="{{ $connection->icon }}" class="btn" radius="medium">
                            {{ $connection->name }}
                        </x-bladewind.button>
                    </a>
                    </li>
                @endforeach
                @if(auth()->user()->role == 'admin')
                    <li class="list-group-item">
                    <a href="{{ route('server.admin', ['ip' => $server->ip_address]) }} ">
                        <x-bladewind.button icon="adjustments-horizontal" radius="medium" class="btn btn-green">
                            Администрирование
                        </x-bladewind.button>
                    </a>
                    </li>
                @endif
            </ul>
        </div>
    </div>
        <br>
    @endforeach
</x-bladewind.centered-content>

<div class="container h-100">
    <div class="row h-100 justify-content-center align-items-center">

        @if(auth()->user()->role == 'admin')
            <a href="{{ route('servers.add') }}" class="col-12">
                <x-bladewind.button class="col-12">
                    Добавить сервер
                </x-bladewind.button>
            </a>
        @endif
    </div>
</div>
@endsection
